
Option Strict On
Option Explicit On

Imports System
Imports System.Web

Imports DotNetNuke.Entities.Users
Imports DotNetNuke.Entities.Modules

Namespace DGZfP.EventPublisher

    ''' <summary>
    ''' Represents a parameter
    ''' </summary>
    ''' 
    <Serializable()> _
    Public Class SourceInfo
        Implements IHydratable

        Public Overrides Function ToString() As String
            Return String.Format("Type:{0}, Context: {1}", Source_Type, Context)
        End Function

        Public Sub New()
            Source_ID = -1
        End Sub


        Public ReadOnly Property IsValid() As Boolean
            Get
                Return True 'CStrN(SqlQuery) <> String.Empty AndAlso CStrN(SqlTable) <> String.Empty
            End Get
        End Property


        Dim _Source_ID As Integer
        Dim _ModuleID As Integer
        Dim _Google_Calendar_ID As String
        Dim _Google_Account As String
        Dim _Google_Password As String
        Dim _Context As String
        Dim _Active As Boolean
        Dim _Source_Type As String
        Dim _Source_Setting_100 As String
        Dim _Source_Setting_2000 As String
        Dim _Source_Setting_50a As String
        Dim _Source_Setting_50b As String
        Dim _Mapping_ID As String
        Dim _Mapping_Start As String
        Dim _Mapping_End As String
        Dim _Mapping_Title As String
        Dim _Mapping_Content As String
        Dim _Mapping_Location As String
        Dim _Mapping_AllDay As String

#Region "Puplic Properties"
        Public ReadOnly Property IsNew() As Boolean
            Get
                Return Source_ID < 0
            End Get
        End Property


        Public Property Source_ID() As Integer
            Get
                Return _Source_ID
            End Get
            Set(ByVal value As Integer)
                _Source_ID = value
            End Set
        End Property
        Public Property ModuleID() As Integer
            Get
                Return _ModuleID
            End Get
            Set(ByVal value As Integer)
                _ModuleID = value
            End Set
        End Property
        Public Property Google_Calendar_ID() As String
            Get
                Return _Google_Calendar_ID
            End Get
            Set(ByVal value As String)
                _Google_Calendar_ID = value
            End Set
        End Property
        ' UsernAme and Password is only filled on GetNextRun (Scheduler)
        Public Property Google_Username() As String
            Get
                Return _Google_Account
            End Get
            Set(ByVal value As String)
                _Google_Account = value
            End Set
        End Property
        Public Property Google_Password() As String
            Get
                Return _Google_Password
            End Get
            Set(ByVal value As String)
                _Google_Password = value
            End Set
        End Property
        Public Property Context() As String
            Get
                Return _Context
            End Get
            Set(ByVal value As String)
                _Context = value
            End Set
        End Property
        Public Property Active() As Boolean
            Get
                Return _Active
            End Get
            Set(ByVal value As Boolean)
                _Active = value
            End Set
        End Property
        Public Property Source_Type() As String
            Get
                Return _Source_Type
            End Get
            Set(ByVal value As String)
                _Source_Type = value
            End Set
        End Property
        Public Property Source_Setting_100() As String
            Get
                Return _Source_Setting_100
            End Get
            Set(ByVal value As String)
                _Source_Setting_100 = value
            End Set
        End Property
        Public Property Source_Setting_2000() As String
            Get
                Return _Source_Setting_2000
            End Get
            Set(ByVal value As String)
                _Source_Setting_2000 = value
            End Set
        End Property
        Public Property Source_Setting_50a() As String
            Get
                Return _Source_Setting_50a
            End Get
            Set(ByVal value As String)
                _Source_Setting_50a = value
            End Set
        End Property
        Public Property Source_Setting_50b() As String
            Get
                Return _Source_Setting_50b
            End Get
            Set(ByVal value As String)
                _Source_Setting_50b = value
            End Set
        End Property
        Public Property Mapping_ID() As String
            Get
                Return _Mapping_ID
            End Get
            Set(ByVal value As String)
                _Mapping_ID = value
            End Set
        End Property
        Public Property Mapping_Start() As String
            Get
                Return _Mapping_Start
            End Get
            Set(ByVal value As String)
                _Mapping_Start = value
            End Set
        End Property
        Public Property Mapping_End() As String
            Get
                Return _Mapping_End
            End Get
            Set(ByVal value As String)
                _Mapping_End = value
            End Set
        End Property
        Public Property Mapping_Title() As String
            Get
                Return _Mapping_Title
            End Get
            Set(ByVal value As String)
                _Mapping_Title = value
            End Set
        End Property
        Public Property Mapping_Content() As String
            Get
                Return _Mapping_Content
            End Get
            Set(ByVal value As String)
                _Mapping_Content = value
            End Set
        End Property
        Public Property Mapping_Location() As String
            Get
                Return _Mapping_Location
            End Get
            Set(ByVal value As String)
                _Mapping_Location = value
            End Set
        End Property
        Public Property Mapping_AllDay() As String
            Get
                Return _Mapping_AllDay
            End Get
            Set(ByVal value As String)
                _Mapping_AllDay = value
            End Set
        End Property
#End Region

        Public Sub Fill(ByVal dr As System.Data.IDataReader) Implements DotNetNuke.Entities.Modules.IHydratable.Fill
            Source_ID = Convert.ToInt32(Null.SetNull(dr.Item("Source_ID"), Source_ID))
            ModuleID = Convert.ToInt32(Null.SetNull(dr.Item("ModuleID"), ModuleID))
            Google_Username = Convert.ToString(Null.SetNull(dr.Item("Account"), Google_Calendar_ID))
            Google_Password = Convert.ToString(Null.SetNull(dr.Item("Password"), Google_Calendar_ID))
            Google_Calendar_ID = Convert.ToString(Null.SetNull(dr.Item("Google_Calendar_ID"), Google_Calendar_ID))
            Context = Convert.ToString(Null.SetNull(dr.Item("Context"), Context))
            Active = Convert.ToBoolean(Null.SetNull(dr.Item("Active"), Active))
            Source_Type = Convert.ToString(Null.SetNull(dr.Item("Source_Type"), Source_Type))
            Source_Setting_100 = Convert.ToString(Null.SetNull(dr.Item("Source_Setting_100"), Source_Setting_100))
            Source_Setting_2000 = Convert.ToString(Null.SetNull(dr.Item("Source_Setting_2000"), Source_Setting_2000))
            Source_Setting_50a = Convert.ToString(Null.SetNull(dr.Item("Source_Setting_50a"), Source_Setting_50a))
            Source_Setting_50b = Convert.ToString(Null.SetNull(dr.Item("Source_Setting_50b"), Source_Setting_50b))
            Mapping_ID = Convert.ToString(Null.SetNull(dr.Item("Mapping_ID"), Mapping_ID))
            Mapping_Start = Convert.ToString(Null.SetNull(dr.Item("Mapping_Start"), Mapping_Start))
            Mapping_End = Convert.ToString(Null.SetNull(dr.Item("Mapping_End"), Mapping_End))
            Mapping_Title = Convert.ToString(Null.SetNull(dr.Item("Mapping_Title"), Mapping_Title))
            Mapping_Content = Convert.ToString(Null.SetNull(dr.Item("Mapping_Content"), Mapping_Content))
            Mapping_Location = Convert.ToString(Null.SetNull(dr.Item("Mapping_Location"), Mapping_Location))
            Mapping_AllDay = Convert.ToString(Null.SetNull(dr.Item("Mapping_AllDay"), Mapping_AllDay))
        End Sub

        Public Property KeyID() As Integer Implements DotNetNuke.Entities.Modules.IHydratable.KeyID
            Get
                Return Source_ID
            End Get
            Set(ByVal value As Integer)
                Source_ID = value
            End Set
        End Property
    End Class
End Namespace
